
jQuery(document).ready(function() {
	
    /*
        Fullscreen background
    */
    $.backstretch("assets/img/login/bg_login.png");
    
    /*
        Form
    */
 
    $("#form1").validate({
        errorPlacement: function(error, element) {  
            error.appendTo(element.parent().parent());  
        },
        rules: {
            company_name: "required",
            user_name: {
                required: true,
                remote: {
                    url: "/check/path/",
                    type: "post",
                    data: {
                        user_name: function() {
                            return $( "input[name=user_name]" ).val();
                        }
                    }
                }
            },
            password: {
                required: true,
            },
        },
        messages: {
            company_name: {
                required: "请输入公司名称",
            },
            user_name: {
                required: "请输入员工姓名／工号",
            },
            password: {
                required: "请输入员工密码",
            },
        },
       
    });
    $("#form2").validate({
        errorPlacement: function(error, element) {  
            error.appendTo(element.parent().parent());  
        },
        rules: {
            company_name: "required",
            user_name: "required",
            password: {
                required: true,
            },
        },
        messages: {
            company_name: {
                required: "请输入公司名称",
            },
            password: {
                required: "请输入员工密码",
            },
        }
       
    });

    // submit
    // $('.registration-form').on('submit', function(e) {
    	
    // 	$(this).find('input[type="text"], input[type="password"], textarea').each(function() {
    // 		if( $(this).val() == "" ) {
    // 			e.preventDefault();
    // 			$(this).addClass('input-error');
    // 		}
    // 		else {
    // 			$(this).removeClass('input-error');
    // 		}
    // 	});
    	
    // });
    
    
});
